import request from '@/utils/request'

// 创建仓储仓库库位
export function createLocation(data) {
  return request({
    url: '/storage/location/create',
    method: 'post',
    data: data
  })
}

// 更新仓储仓库库位
export function updateLocation(data) {
  return request({
    url: '/storage/location/update',
    method: 'put',
    data: data
  })
}

// 删除仓储仓库库位
export function deleteLocation(id) {
  return request({
    url: '/storage/location/delete?id=' + id,
    method: 'delete'
  })
}

/** 批量删除仓储仓库库位 */
export function deleteLocationList(ids) {
  return request({
    url: `/storage/location/delete-list?ids=${ids.join(',')}`,
    method: 'delete'
  })
}

// 获得仓储仓库库位
export function getLocation(id) {
  return request({
    url: '/storage/location/get?id=' + id,
    method: 'get'
  })
}

// 获得仓储仓库库位分页
export function getLocationPage(params) {
  return request({
    url: '/storage/location/page',
    method: 'get',
    params
  })
}
// 导出仓储仓库库位 Excel
export function exportLocationExcel(params) {
  return request({
    url: '/storage/location/export-excel',
    method: 'get',
    params,
    responseType: 'blob'
  })
}